set(SUBLIB_NAME xembedtosniproxy)
#find_package(Qt5 REQUIRED COMPONENTS DBus)

#判断编译器类型,如果是gcc编译器,则在编译选项中加入c++11支持
if(CMAKE_COMPILER_IS_GNUCXX)
   set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
   message(STATUS "optional:-std=c++11")
endif(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
find_package(Qt5 COMPONENTS Widgets Core X11Extras REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(KF5WindowSystem REQUIRED)
find_package(X11 REQUIRED)


set(HEADERS
    snidbus.h
    sniproxy.h
    snixembedproxy.h
    xtestsender.h
    xcbutilss.h
    statusnotifierwatcherinterface.h
)
set(SOURCES
    snidbus.cpp
    sniproxy.cpp
    snixembedproxy.cpp
    xtestsender.cpp
    statusnotifierwatcherinterface.cpp
)

#qt5_add_dbus_adaptor(${SOURCES} org.kde.StatusNotifierItem.xml
#                     sniproxy.h SNIProxy)

set(statusnotifierwatcher_xml  ../statusnotifierwatcher/org.kde.StatusNotifierWatcher.xml)
qt5_add_dbus_interface(${SOURCES} ${statusnotifierwatcher_xml} statusnotifierwatcherinterface)

add_library(${SUBLIB_NAME} ${HEADERS} ${SOURCES})
# 链接对象库
target_link_libraries( ${SUBLIB_NAME}
#    ${Qt5X11Extras_LIBRARIES}
    Qt5::X11Extras
    Qt5::Widgets
    Qt5::DBus
    KF5::WindowSystem
    xcb
    xcb-util
    xcb-damage
    xcb-image
    xcb-composite
    xcb-shape
    -lukui-log4qt
    -lQt5Xdg
    ${XCB_LIBS}
    ${X11_XTest_LIB}
)

add_definitions(-DQT_NO_KEYWORDS)
add_definitions(-DQT_MESSAGELOGCONTEXT)



